#include <iostream>

using namespace std;
typedef long long LL;
LL qpow(LL a, LL b)
{
    LL ret = 1;
    while (b)
    {
        if(a > 1e9) return -1;
        if (b & 1)
            ret = ret * a;
            if(ret > 1e9) return -1;
        a = a * a;
        b >>= 1;
    }
    return ret;
}

int main()
{
    int a, b;
    cin >> a >> b;
    cout << qpow(a, b) << endl;
    return 0;
}